<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSnsGroupTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        Schema::create('sns_group', function(Blueprint $table){
            $table->increments('id');
            $table->string('group_name', 50);
            $table->text('group_intro')->nullable()->defaults('');
            $table->string('group_avatar',100)->nullable()->defaults('');
            $table->string('work_scope', 120)->nullable()->defaults('');
            $table->string('province',100)->nullable()->defaults('');
            $table->string('city',100)->nullable()->defaults('');
            $table->string('district',100)->nullable()->defaults('');
            $table->integer('fans_cnt')->defaults(0)->nullable();
            $table->integer('member_cnt')->defaults(0)->nullable();
            $table->integer('post_count')->defaults(0)->nullable();
            $table->integer('created_by')->defaults(0)->nullable();
            $table->timestamps();
        });
        Schema::create('sns_group_member', function(Blueprint $table){
            $table->increments('id');
            $table->integer('group_id')->defaults(0)->nullable();
            $table->integer('user_id')->defaults(0)->nullable();
            $table->tinyInteger('is_admin')->defaults(0)->nullable();
            $table->tinyInteger('is_creator')->defaults(0)->nullable();
            $table->tinyInteger('is_passed')->defaults(0)->nullable();
            $table->timestamps();
        });
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
        Schema::drop('sns_group');
        Schema::drop('sns_group_member');
	}

}
